package com.example.hehecat.yuejian1.mvp.presenter;

import android.util.Log;

import com.example.hehecat.yuejian1.mvp.contract.ActivityReplyContract;
import com.example.hehecat.yuejian1.mvp.model.ActivityReplyModel;
import com.example.hehecat.yuejian1.mvp.model.bean.ReplyBean;

import java.util.List;

import rx.Subscriber;

import static com.chad.library.adapter.base.listener.SimpleClickListener.TAG;

public class ActivityReplyPresenter implements ActivityReplyContract.Presenter {
    private ActivityReplyContract.Model model;
    private ActivityReplyContract.View view;

    public ActivityReplyPresenter(ActivityReplyContract.View view) {
        this.view = view;
        model = new ActivityReplyModel();
    }

    @Override
    public void updateAdapterData(int activity_id) {
        model.getAllReplyData(activity_id, new Subscriber<List<ReplyBean>>() {
            @Override
            public void onCompleted() {

            }

            @Override
            public void onError(Throwable e) {
                Log.d(TAG, "onError: "+"get reply error");
            }

            @Override
            public void onNext(List<ReplyBean> replyBeans) {
                view.updateAdapterData(replyBeans);
            }
        });
    }
}
